const mysql = require('mysql');

let pool = mysql.createPool({
    host:'49.233.166.46',
    user:'root',
    password:'jujiabin.23',
    database:'xtzx',
    port:3306
});
var db = function(sql,callback){
    pool.getConnection(function(err,conn){
        if(err){
         callback(err,null,null);
        }else{
         conn.query(sql,function(qerr,vals,fields){
          //释放连接
          conn.release();
          //事件驱动回调
          callback(qerr,vals,fields);
         });
        }
       });
}
module.exports = db;
